<?php
/**
 *与cb交互的接口
 *@author sundongdong
 */
class Interface_CbController extends Controller_Interface {
	public function init() {
		parent::init();
	}
	/**
	 * 接受产品中心的上下架记录
	 * @author sundongdong
	 */
	public function upShelfAction() {
		$data = $this->getRequest()->getParam('data');

		$this->log->record("接收产品上下架记录数据 : " . urldecode($data));
		if (!$this->verifySign()) {
			die(json_encode(array('opr' => -1, 'data' => 'Key Error')));
		}
		$data = @json_decode(stripslashes($data), true);
		if (!is_array($data)) {
			die(json_encode(array('opr' => -1, 'data' => 'empty data')));
		}

		$model = new Interface_Model_Upshelf();
		$res = $model->add($data);
		echo json_encode($res);
	}
}